package com.zsk.daily.accumulation.web.controller;

import com.zsk.daily.accumulation.biz.manager.UserInfoManager;
import com.zsk.daily.accumulation.web.model.request.user.GetUserInfoRequest;
import com.zsk.daily.accumulation.web.model.result.ResponseMsg;
import com.zsk.daily.accumulation.web.model.result.user.GetUserInfoResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author zhaijun
 * @version :1.0 UserInfoController.java, v 0.1 2023-04-10 9:48 zhaijun Exp $
 */

@RequestMapping("/user")
@RestController
public class UserInfoController {

    @Autowired
    UserInfoManager userInfoManager;

    /**
     * 获取用户信息
     * curl --location 'localhost:8080/user/getUserInfo' \--header 'Content-Type: application/json' \--data '{ "maxAge": "11","deptName": "上海"}'
     *
     * @param request 请求
     * @return {@link ResponseMsg}<{@link GetUserInfoResult}>
     */
    @PostMapping("/getUserInfo")
    public ResponseMsg<GetUserInfoResult> getUserInfo(@Validated @RequestBody GetUserInfoRequest request) {
        //业务处理获取用户信息
        GetUserInfoResult result = userInfoManager.getUserInfo(request);
        return ResponseMsg.buildSuccessInstance(result);
    }
}